package com.hjj.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hjj.springboot.entity.OrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderDetailMapper extends BaseMapper<OrderDetail> {

    @Select("SELECT od.goodsId, od.goodsNumber " +
            "FROM t_order_detail od " +
            "JOIN t_order o ON od.mId = o.id " +
            "WHERE o.userId = #{userId}")
    List<OrderDetail> selectUserPurchaseDetails(@Param("userId") String userId);
}
